import { EntityBase } from 'ibiz-core';
import { ICUSTOMER } from '../interface';

/**
 * 客户基类
 *
 * @export
 * @abstract
 * @class CUSTOMERBase
 * @extends {EntityBase}
 * @implements {ICUSTOMER}
 */
export abstract class CUSTOMERBase extends EntityBase implements ICUSTOMER {
    /**
     * 实体名称
     *
     * @readonly
     * @type {string}
     * @memberof CUSTOMERBase
     */
    get srfdename(): string {
        return 'CUSTOMER';
    }
    get srfkey() {
        return this.customerid;
    }
    set srfkey(val: any) {
        this.customerid = val;
    }
    get srfmajortext() {
        return this.customername;
    }
    set srfmajortext(val: any) {
        this.customername = val;
    }
    /**
     * 客户标识
     */
    customerid?: any;
    /**
     * 更新人
     */
    updateman?: any;
    /**
     * 建立时间
     */
    createdate?: any;
    /**
     * 客户名称
     */
    customername?: any;
    /**
     * 建立人
     */
    createman?: any;
    /**
     * 更新时间
     */
    updatedate?: any;

    /**
     * 重置实体数据
     *
     * @private
     * @param {*} [data={}]
     * @memberof CUSTOMERBase
     */
    reset(data: any = {}): void {
        super.reset(data);
        this.customerid = data.customerid || data.srfkey;
        this.customername = data.customername || data.srfmajortext;
    }
}
